import os

def traverse_folder(folder_path):
    for root, dirs, files in os.walk(folder_path):
        for file in files:
            if file.endswith(".png"):
                file_name, file_ext = os.path.splitext(file)
                if len(file_name) < 5:
                    file_name = file_name.zfill(5)
                new_file_name = file_name + file_ext
                file_path = os.path.join(root, file)
                new_file_path = os.path.join(root, new_file_name)
                os.rename(file_path, new_file_path)

# Replace 'folder_path' with the path to your desired folder
folder_path = '.'
traverse_folder(folder_path)